package demo5;

interface Shape {
    double area(double num);
}
class Square implements Shape{

    @Override
    public double area(double num) {
        return num*num;
    }
}
class Circle implements Shape{

    @Override
    public double area(double num) {
        return Math.PI * num * num;
    }
}
public class Test {
    public static void main(String[] args) {
        Shape shape = new Circle();
        System.out.println("正方形的面积: "  + shape.area(3));
        Shape shape1 = new Square();
        System.out.println("圆形的面积 : " + shape1.area(2));

    }
}
